<template>
	<view class="data_card" @click="goDetail">
		<view class="u-flex  u-flex-items-center u-m-b-24">
			<format :format="data.fileData.format"></format>
			<view class="f-s-16 u-m-l-20 f-w-b u-line-1">{{ data.fileData.title }}</view>
		</view>
		<view class="content">
			<Price :price="data.fileData.price" />
			<view @click.stop>
				<u-button text="取消收藏" color="#F3F3F4" :customStyle="{
										color: '#303133',fontWeight: 'bolder'
									}" @click="collectClick" size="small"></u-button>
			</view>
		</view>
	</view>
</template>
<script setup>
	import Tag from '@/components/common/tag.vue'
	import Price from '@/components/common/price.vue'
	import Format from '@/components/common/format.vue'
	import teacherIconText from "@/components/common/teacher-icon-text.vue"
	import {
		ref,
		defineProps
	} from 'vue';
	import {
		addCollect,
	} from "@/api/data.js"
	import {
		delCollect
	} from '@/api/user.js'
	const props = defineProps({
		data: Object
	})
	let isFollow = ref(true)
	const emit =defineEmits(['dataList'])
	function goDetail() {
		uni.navigateTo({
			url: '/subPackages/data/index?id=' + props.data.otherId
		})
	}
	function collectClick() {
		//取消收藏
		delCollect(props.data.id)
		emit('dataList')
	}
</script>

<style lang="scss">
	.data_card {
		flex: 1;
		background-color: #fff;
		margin-bottom: 12px;
		border-radius: 8px;
		padding: 12px;

		.content {
			display: flex;
			align-items: center;
			justify-content: space-between;
			margin-top: 14px;
			color: #9b9b9b;
			font-size: 12px;

			.people {
				display: flex;
				align-items: center;
			}
		}
	}
</style>